package dipl.algorithm.math.fp.geometry;

import dipl.algorithm.math.fp.primitive.Vector2df;

/**
 *  2d-bounding wedge defined by (clockwise)left bounding vector and opening angle
 */
public class BoundingWedge2d {

	//
	// CONSTRUCTOR METHODS
	//

	/**
	 * Construct wedge from given left bounding vector in clockwise direction and opening angle.
	 * Bounding vectors must not have zero length!
	 *
	 * @param left (clockwise)left bounding vector
	 * @param angle opening angle (in radians)
	 */
	public BoundingWedge2d( Vector2df left, double angle ) {
		this.left = left;
		this.angle = angle;
	}

	//
	// PUBLIC METHODS
	//

	/**
	 * Returns whether wedge is degenerated.
	 * A wedge is degenerated if its opening angle is zero.
	 * @param fpMath
	 * @return degenerated or not
	 */
	public boolean IsDegenerated() {
		return angle == 0.0;
	}

	@Override
	public String toString() {
		return "["+"left:"+left.toString()+" angle:"+angle*( 1.0/(Math.PI/180.0))+"°]";
	}

	//
	// PROPERTIES
	//

	/**
	 * Gets opening angle starting at left bounding vector clockwise (in radians)
	 * @return
	 */
	public double Angle() {
		return angle;
	}

	/**
	 * Gets (clockwise) left bounding vector
	 * @return
	 */
	public Vector2df Left() {
		return left;
	}

	//
	// MEMBERS
	//

	/** (clockwise) left bounding vector */
	private Vector2df left;
	/** opening angle */
	private double angle;
}
